{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "\n",
    "geo_url = \"https://restapi.amap.com/v3/geocode/geo?parameters\"\n",
    "\n",
    "payload = {\n",
    "    \"key\":\"b6460f39ad29f96cd7e126f2bcba364c\",\n",
    "    \"address\":\"广东省广州市从化区\"\n",
    "}\n",
    "\n",
    "r = requests.get(url=geo_url,params=payload)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': '1',\n",
       " 'info': 'OK',\n",
       " 'infocode': '10000',\n",
       " 'count': '1',\n",
       " 'geocodes': [{'formatted_address': '广东省广州市从化区',\n",
       "   'country': '中国',\n",
       "   'province': '广东省',\n",
       "   'citycode': '020',\n",
       "   'city': '广州市',\n",
       "   'district': '从化区',\n",
       "   'township': [],\n",
       "   'neighborhood': {'name': [], 'type': []},\n",
       "   'building': {'name': [], 'type': []},\n",
       "   'adcode': '440117',\n",
       "   'street': [],\n",
       "   'number': [],\n",
       "   'location': '113.586605,23.548852',\n",
       "   'level': '区县'}]}"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "广州南方_location = r.json()['geocodes'][0]['location']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'113.586605,23.548852'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "广州南方_location"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "def food_poi(location):\n",
    "    url=\"https://restapi.amap.com/v5/place/around?parameters\"\n",
    "    params={\n",
    "        \"key\":\"b6460f39ad29f96cd7e126f2bcba364c\",\n",
    "        \"types\":\"050100|050200|050300\",\n",
    "        \"location\":广州南方_location, \n",
    "        \"radius\": 50000,\n",
    "        \"show_fields\":\"photos,business\",\n",
    "        \"page_size\":25,\n",
    "        \"page_num\":5\n",
    "    }\n",
    "    r=requests.get(url,params=params)\n",
    "    return r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'name': '昌记牛腩粉',\n",
       "  'id': 'B0H2L56NOQ',\n",
       "  'location': '113.581409,23.552519',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '环城路14号',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '城郊',\n",
       "   'tel': '17827128881',\n",
       "   'rectag': '中餐',\n",
       "   'keytag': '中餐',\n",
       "   'rating': '4.0',\n",
       "   'opentime_today': '06:00-15:30',\n",
       "   'opentime_week': '06:00-15:30'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/311e0fa98f830fd311365570f0310017'}]},\n",
       " {'name': '祥发美食',\n",
       "  'id': 'B0G2M4XGJ7',\n",
       "  'location': '113.581358,23.552471',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '环城路从化第二中学东侧约100米',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'tel': '020-87936476;13926190879',\n",
       "   'rectag': '中餐',\n",
       "   'keytag': '中餐'}},\n",
       " {'name': '从化五道菜',\n",
       "  'id': 'B00141KAMJ',\n",
       "  'location': '113.587389,23.542874',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '建云东路与府前路交叉口西40米',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口', 'rectag': '中餐', 'keytag': '中餐'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/b29f3d60915f013ae0bdb82e35bb098b'}]},\n",
       " {'name': '蒸武门(街口一店)',\n",
       "  'id': 'B0H255LNAI',\n",
       "  'location': '113.592361,23.551754',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '城郊街溪畔雅街45号49101铺-',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'tel': '18922457255',\n",
       "   'rectag': '中餐',\n",
       "   'keytag': '中餐',\n",
       "   'rating': '4.2',\n",
       "   'opentime_today': '24小时营业',\n",
       "   'opentime_week': '00:00-24:00'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/3c710d11b547fd54c54eee5ea0302bfc'},\n",
       "   {'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/854090a410a5bf75213be733afea452e'}]},\n",
       " {'name': '辻粤味(建云东路店)',\n",
       "  'id': 'B0I6XHEDB5',\n",
       "  'location': '113.586111,23.542845',\n",
       "  'type': '餐饮服务;快餐厅;快餐厅',\n",
       "  'typecode': '050300',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '建云东路106.108号铺',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'tel': '18028642628',\n",
       "   'rectag': '小吃快餐',\n",
       "   'keytag': '小吃快餐',\n",
       "   'rating': '4.0'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/5ecf10b4f684420288a5ff5563f3fe8e'}]},\n",
       " {'name': '金辉饭店(建云东路店)',\n",
       "  'id': 'B00140MDP4',\n",
       "  'location': '113.587438,23.542851',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '建云东路72号',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'tel': '020-87941907;13922160636;13725109178',\n",
       "   'rectag': '粤菜',\n",
       "   'keytag': '粤菜',\n",
       "   'rating': '4.4'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/0ae6a1af9ecdeec1b84b93c204f9d413'},\n",
       "   {'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/5d52758f02afff8ad3a42beec88013c9'},\n",
       "   {'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/b37944822c51c2e697e0e4ce23440cae'}]},\n",
       " {'name': '萌君美食',\n",
       "  'id': 'B0I6OS7W0I',\n",
       "  'location': '113.590635,23.544008',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '碧溪横一街与中田东路交叉口南20米',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口', 'rectag': '中餐', 'keytag': '中餐'}},\n",
       " {'name': '幸运儿拉肠',\n",
       "  'id': 'B0FFF3UXEG',\n",
       "  'location': '113.591722,23.552776',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '盈兴名苑39号',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '城郊',\n",
       "   'tel': '13640310285',\n",
       "   'rectag': '中餐',\n",
       "   'keytag': '中餐',\n",
       "   'rating': '3.7'}},\n",
       " {'name': '萌君私房菜',\n",
       "  'id': 'B0FFK8ZNPD',\n",
       "  'location': '113.590643,23.543977',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '碧溪横一巷101号',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'tel': '13710135109',\n",
       "   'rectag': '私房菜',\n",
       "   'keytag': '私房菜',\n",
       "   'rating': '4.2',\n",
       "   'cost': '50.00'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/cfde7cc64551eedf40a9a1bc9ba2e210'}]},\n",
       " {'name': '食天光美食店',\n",
       "  'id': 'B0G35DUKCU',\n",
       "  'location': '113.585475,23.542786',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '街口街建云东路136号之一',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'tel': '13922452413',\n",
       "   'rectag': '粤菜',\n",
       "   'keytag': '粤菜',\n",
       "   'rating': '3.5'}},\n",
       " {'name': '霸道酸菜鱼',\n",
       "  'id': 'B0FFH9KVSC',\n",
       "  'location': '113.585544,23.542774',\n",
       "  'type': '餐饮服务;中餐厅;四川菜(川菜)',\n",
       "  'typecode': '050102',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '建云东路128号新城小学背后(标准桌球城)',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'tel': '18022865823;020-87928338',\n",
       "   'rectag': '酸菜鱼',\n",
       "   'keytag': '酸菜鱼',\n",
       "   'rating': '4.6',\n",
       "   'cost': '42.00',\n",
       "   'opentime_today': '09:00-22:30',\n",
       "   'opentime_week': '09:00-22:30'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/9d31c416aec7e2d55e0774fadf83bd50'},\n",
       "   {'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/0ef43411c7d4b797c839805a0a9f1fb3'},\n",
       "   {'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/44b5b1c1a503756d2ec484597e010196'}]},\n",
       " {'name': '十分粥道',\n",
       "  'id': 'B0HROCKJXL',\n",
       "  'location': '113.581085,23.552362',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '街口街环城路26号',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '城郊',\n",
       "   'rectag': '小吃快餐',\n",
       "   'keytag': '小吃快餐',\n",
       "   'rating': '2.5'}},\n",
       " {'name': '炭烧往事',\n",
       "  'id': 'B0HBBY2APB',\n",
       "  'location': '113.591752,23.552817',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '盈兴名苑44号',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '城郊',\n",
       "   'tel': '13926154448',\n",
       "   'rectag': '中餐',\n",
       "   'keytag': '中餐',\n",
       "   'rating': '3.9',\n",
       "   'opentime_today': '20:00-05:00',\n",
       "   'opentime_week': '周一至周日:20:00-05:00'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/20d4a35f35174ec4d2bb0d982cb30982'}]},\n",
       " {'name': '赵姐美食店',\n",
       "  'id': 'B0HRMZIAXJ',\n",
       "  'location': '113.581357,23.552705',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '环城路从化第二中学东侧约100米',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口', 'rectag': '中餐', 'keytag': '中餐'}},\n",
       " {'name': '美姐煲仔粉',\n",
       "  'id': 'B0GK6RU0Y7',\n",
       "  'location': '113.590587,23.543823',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '碧溪直巷7-9-11号',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'tel': '13711028893',\n",
       "   'rectag': '小吃快餐',\n",
       "   'keytag': '小吃快餐',\n",
       "   'rating': '3.8',\n",
       "   'opentime_today': '06:00-16:00',\n",
       "   'opentime_week': '每天06:00-16:00'}},\n",
       " {'name': '尚悦西餐厅',\n",
       "  'id': 'B0IGSU48XX',\n",
       "  'location': '113.591447,23.544403',\n",
       "  'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "  'typecode': '050201',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '河滨南路与中田东路交叉口北20米',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'rectag': '西餐',\n",
       "   'keytag': '西餐',\n",
       "   'rating': '4.1'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/00a37a2afd17b73fe889913533d43a82'},\n",
       "   {'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/ecea2da2bad74cebc5d87026fd92bde3'},\n",
       "   {'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/f33da6b3749e381abad05bdb2c37a54e'}]},\n",
       " {'name': '豪旺客西餐厅',\n",
       "  'id': 'B0I63GVJH4',\n",
       "  'location': '113.589520,23.543149',\n",
       "  'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "  'typecode': '050201',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '建云东路与建设路交叉口西北20米',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口', 'rectag': '西餐', 'keytag': '西餐'}},\n",
       " {'name': '好记港式大排档',\n",
       "  'id': 'B00140V0F9',\n",
       "  'location': '113.591452,23.544386',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '街口街河滨南路10号',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'tel': '020-87955597',\n",
       "   'rectag': '中餐',\n",
       "   'keytag': '中餐',\n",
       "   'rating': '3.9',\n",
       "   'cost': '51.00',\n",
       "   'opentime_today': '17:30-02:00',\n",
       "   'opentime_week': '17:30-02:00'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/0ab7ba18974b8f3832b013303f2e91ee'}]},\n",
       " {'name': '喜点',\n",
       "  'id': 'B0FFLDINZZ',\n",
       "  'location': '113.589132,23.542992',\n",
       "  'type': '餐饮服务;中餐厅;广东菜(粤菜)',\n",
       "  'typecode': '050103',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '建云东路与建云东二巷交叉口东20米',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口', 'rectag': '中餐', 'keytag': '中餐'}},\n",
       " {'name': '小黄人街头牛扒',\n",
       "  'id': 'B0H1ZU71E2',\n",
       "  'location': '113.589537,23.543137',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '建云东路3号',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'rectag': '牛排',\n",
       "   'keytag': '牛排',\n",
       "   'rating': '2.8'}},\n",
       " {'name': '永昌隆江猪脚饭(新城总店)',\n",
       "  'id': 'B0FFK0MOKP',\n",
       "  'location': '113.589603,23.543154',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '建设路与建云东路交叉口西北20米',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'rectag': '猪脚饭',\n",
       "   'keytag': '猪脚饭',\n",
       "   'rating': '3.9',\n",
       "   'cost': '16.00'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/d3ada899360204478a48d1062256f81c'}]},\n",
       " {'name': '如简西餐厅',\n",
       "  'id': 'B0HGDC8VE3',\n",
       "  'location': '113.581510,23.553172',\n",
       "  'type': '餐饮服务;外国餐厅;西餐厅(综合风味)',\n",
       "  'typecode': '050201',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '城郊街新城西路18号',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '街口',\n",
       "   'tel': '13798146718',\n",
       "   'rectag': '西餐',\n",
       "   'keytag': '西餐',\n",
       "   'opentime_today': '10:30-24:00',\n",
       "   'opentime_week': '10:30-24:00'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/2f77f03dd705a5f57c809d0dc6409468'}]},\n",
       " {'name': '镇北美食',\n",
       "  'id': 'B0IB3RB8K3',\n",
       "  'location': '113.591914,23.552976',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '镇北路与龙新横街交叉口西南60米',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '城郊', 'rectag': '中餐', 'keytag': '中餐'}},\n",
       " {'name': '兄弟狗羊煲',\n",
       "  'id': 'B0IG6DDPJT',\n",
       "  'location': '113.583135,23.554459',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '福泉街与新村北路交叉口南140米',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '城郊', 'rectag': '中餐', 'keytag': '中餐'}},\n",
       " {'name': '贵州牛肉粉',\n",
       "  'id': 'B0FFLJUCKF',\n",
       "  'location': '113.593473,23.550324',\n",
       "  'type': '餐饮服务;中餐厅;中餐厅',\n",
       "  'typecode': '050100',\n",
       "  'pname': '广东省',\n",
       "  'cityname': '广州市',\n",
       "  'adname': '从化区',\n",
       "  'address': '河滨北路金裕街14一16号',\n",
       "  'pcode': '440000',\n",
       "  'citycode': '020',\n",
       "  'adcode': '440117',\n",
       "  'business': {'business_area': '城郊',\n",
       "   'tel': '13926229771',\n",
       "   'rectag': '米粉',\n",
       "   'keytag': '米粉',\n",
       "   'rating': '4.1',\n",
       "   'opentime_today': '06:00-21:00',\n",
       "   'opentime_week': '06:00-21:00'},\n",
       "  'photos': [{'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/96d92e8e68a03618e489adcf3fa37e8e'},\n",
       "   {'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/a9141b0f854a0bfac4fbaf5067ac2995'},\n",
       "   {'title': '',\n",
       "    'url': 'http://store.is.autonavi.com/showpic/3632a0fa4b3f26390d72b3e321f86aab'}]}]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "food_poi(广州南方_location)[\"pois\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "ename": "ImportError",
     "evalue": "cannot import name 'json_normalize' from 'pandas' (D:\\anaconda\\lib\\site-packages\\pandas\\__init__.py)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mImportError\u001b[0m                               Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-17-66f5b88926da>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;31m# 数据处理\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mpandas\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[0mpandas\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mjson_normalize\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      4\u001b[0m \u001b[0mdf\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mjson_normalize\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfood_poi\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0m广州南方_location\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"pois\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      5\u001b[0m \u001b[0mdf\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mImportError\u001b[0m: cannot import name 'json_normalize' from 'pandas' (D:\\anaconda\\lib\\site-packages\\pandas\\__init__.py)"
     ]
    }
   ],
   "source": [
    "# 数据处理\n",
    "import pandas as pd\n",
    "from pandas import json_normalize\n",
    "df = pd.json_normalize(food_poi(广州南方_location)[\"pois\"])\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting pandas\n",
      "  Using cached https://files.pythonhosted.org/packages/47/17/5c4b04caa8fe1dca2aa940dcc00319aa77c84fbdb71f83869a0900cac660/pandas-1.1.5-cp37-cp37m-win_amd64.whl\n",
      "Collecting numpy>=1.15.4 (from pandas)\n",
      "  Using cached https://files.pythonhosted.org/packages/97/9f/da37cc4a188a1d5d203d65ab28d6504e17594b5342e0c1dc5610ee6f4535/numpy-1.21.6-cp37-cp37m-win_amd64.whl\n",
      "Requirement not upgraded as not directly required: python-dateutil>=2.7.3 in d:\\anaconda\\lib\\site-packages (from pandas) (2.7.3)\n",
      "Requirement not upgraded as not directly required: pytz>=2017.2 in d:\\anaconda\\lib\\site-packages (from pandas) (2018.5)\n",
      "Requirement not upgraded as not directly required: six>=1.5 in d:\\anaconda\\lib\\site-packages (from python-dateutil>=2.7.3->pandas) (1.11.0)\n",
      "Installing collected packages: numpy, pandas\n",
      "  Found existing installation: numpy 1.15.1\n",
      "    Uninstalling numpy-1.15.1:\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.\n",
      "Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'd:\\\\anaconda\\\\lib\\\\site-packages\\\\numpy\\\\core\\\\multiarray.cp37-win_amd64.pyd'\n",
      "Consider using the `--user` option or check the permissions.\n",
      "\n",
      "You are using pip version 10.0.1, however version 22.0.4 is available.\n",
      "You should consider upgrading via the 'python -m pip install --upgrade pip' command.\n"
     ]
    }
   ],
   "source": [
    "!pip install --upgrade pandas"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
